<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- 页面meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

	<title>乐学优课OA系统</title>
<meta name="description" content="乐学优课OA系统">
<meta name="keywords" content="乐学优课OA系统">




<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
	name="viewport">


<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionicons/css/ionicons.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/iCheck/square/blue.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/morris/morris.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/datepicker/datepicker3.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/datatables/dataTables.bootstrap.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.theme.default.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/select2/select2.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/colorpicker/bootstrap-colorpicker.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/adminLTE/css/skins/_all-skins.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/style.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.skinNice.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-slider/slider.css">

</head>

<body class="hold-transition skin-purple sidebar-mini" >

	<div class="wrapper">

		<!-- 页面头部 -->
		<jsp:include page="header.jsp"></jsp:include>
		<!-- 页面头部 /-->

		<!-- 导航侧栏 -->
		<jsp:include page="aside.jsp"></jsp:include>
		<!-- 导航侧栏 /-->

		<!-- 内容区域 -->
		<div class="content-wrapper">

			<!-- 内容头部 -->
			<section class="content-header">
			<h1>
				统计管理 <small>作业率添加页面</small>
			</h1>
			<ol class="breadcrumb">
				<li><a href="${pageContext.request.contextPath}/index.jsp"><i
						class="fa fa-dashboard"></i> 首页</a></li>
				<li><a id="tjym" href="">统计管理</a></li>
	
				<li class="active">作业率添加页面</li>
			</ol>
			</section>
			<!-- 内容头部 /-->
			 <%--班级数据详情页展示部分--%>
            <section class="content-main" style="width: 100%">

				<p>作业率添加界面</p>

				<form class="form-inline " style="float: right" action="${pageContext.request.contextPath}/statistic/zyAddPage" method="post">
					<security:csrfInput />
					<input type="hidden" name="cid" value="${requestScope.cid}">
					<div class="form-group">
						<label for="date">查询日期:</label>
						<input type="date" class="form-control" id="date" name="recordDate" placeholder="选择查询的日期">
					</div>
					<button type="submit" class="btn btn-default">查 询</button>
				</form>

              <form id="addform" action="${pageContext.request.contextPath}/statistic/saveTask" method="post" >
				  <security:csrfInput/>
				  <input type="hidden" id="cid" name="list[0].cid" value="${requestScope.cid}">
				  <input type="hidden"  name="pageNum" value="${requestScope.pageInfo.pageNum}">
				  <fmt:formatDate value="${condition.recordDate}"  type="date" pattern='yyyy-MM-dd' var="date"/>
				  <input type="hidden" name="recordDate" value="${date}">
				  <table class="table table-bordered table-striped table-hover dataTable">
					 <tr>
						 <th>序號</th>
						 <th>学生姓名</th>
						 <th width="13%">日期</th>
						 <th width="13%">课程</th>
						 <th>到课状态</th>
						 <th>备注</th>
					 </tr>

					 <c:forEach items="${requestScope.pageInfo.list}" var="item" varStatus="stus">
						 <%--<fmt:formatDate value="${item.recordDate}"  type="date" pattern='yyyy-MM-dd' var="date"/>--%>
						 <tr>
							 <td>${stus.count}<input type="hidden" name="list[${stus.index}].sid" value="${item.sid}" /></td>
							 <td>${item.stdName}</td>
							 <td width="13%" >
								  <input
									  <%-- <c:if test="${stus.count==1}" >type="date"</c:if>
									   <c:if test="${stus.count!=1}" >type="text"  readonly</c:if>--%>
									   type="text"
									   readonly
									   style="background-color: lightgrey"
										name="list[${stus.index}].recordDate" class="rq" value="<fmt:formatDate value='${item.recordDate}'  pattern='yyyy-MM-dd' />"
								    />
							 </td>
							 <td width="13%"><input type="text"  class="kc" readonly name="list[${stus.index}].course" value="${item.course}" placehold="请填入课程名称"></td>
							 <td>
								 <select name="list[${stus.index}].status" >
									 <option value="0">未到</option>
									 <option value="1" selected>已到</option>
									 <option value="2">请假</option>
								 </select>
							 </td>
							 <td><textarea rows="1" cols="10" name="list[${stus.index}].info" ></textarea></td>
						 </tr>
					 </c:forEach>
					 <tr><td colspan="6" style="text-align: center"><input class="btn-primary" type="submit" value="添&nbsp;加" ></td></tr>
				 </table>
			  </form>

				<!-- .box-footer-->
				<div class="box-footer">
					<div class="pull-left">
						<div class="form-group form-inline">
							总共${pageInfo.pages} 页，共${pageInfo.total} 条数据。 每页 <select class="form-control" id="sel" >
							<option <c:if test="${pageInfo.pageSize==10}">selected </c:if>>10</option>
							<option <c:if test="${pageInfo.pageSize==15}">selected </c:if>>15</option>
							<option <c:if test="${pageInfo.pageSize==20}">selected </c:if>>20</option>
							<option <c:if test="${pageInfo.pageSize==50}">selected </c:if>>50</option>
							<option <c:if test="${pageInfo.pageSize==80}">selected </c:if>>80</option>
						</select> 条
						</div>
					</div>

					<div class="box-tools pull-right">
						<ul class="pagination">
							<c:if test="${pageInfo.pageNum==1}">
								<li class="disabled">
									<span>
										首页
									</span>
								</li>
								<li>
									<span>
										上一页
									</span>
								</li>
							</c:if>
							<c:if test="${pageInfo.pageNum>1}" >
								<li  >
									<a href="${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageNum=1&pageSize=${pageInfo.pageSize}"  aria-label="Previous">
										首页
									</a>
								</li>
								<li>
									<a href="${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageNum=${requestScope.pageInfo.pageNum-1}&pageSize=${pageInfo.pageSize}">上一页</a>
								</li>
							</c:if>
							<c:choose>
								<c:when test="${pageInfo.pages>=5}" >
									<%--在页面展示出5条页码数--%>
									<c:forEach
											begin="${pageInfo.pageNum>=pageInfo.pages-4?pageInfo.pages-4:pageInfo.pageNum}"
											end="${pageInfo.pageNum<=pageInfo.pages-4?pageInfo.pageNum+4:pageInfo.pages}"
											var="pageNum"
									>
									 <c:if test="${pageInfo.pageNum == pageNum}" >
										 <li>
											 <span>
													 ${pageInfo.pageNum}
											 </span>
										 </li>
									 </c:if>
								     <c:if test="${pageInfo.pageNum != pageNum}" >
										<%--显示当前选中的页数--%>
										<li >
											<a href="${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageNum=${pageNum}&pageSize=${pageInfo.pageSize}">
													${pageNum}
											</a>
										</li>
									 </c:if>
									</c:forEach>
								</c:when>

								<%--数据过少，页码小于5页时--%>
								<c:when test="${pageInfo.pages<5}">
									<%--在页面展示出5条页码数--%>
									<c:forEach
											begin="1"
											end="${pageInfo.pages}"
											var="pageNum">
										<c:if test="${pageInfo.pageNum == pageNum}" >
											<li>
											 <span>
													 ${pageInfo.pageNum}
											 </span>
											</li>
										</c:if>
										<c:if test="${pageInfo.pageNum != pageNum}" >
											<%--显示当前选中的页数--%>
											<li>
												<a href="${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageNum=${pageNum}&pageSize=${pageInfo.pageSize}">${pageNum}</a>
											</li>
									    </c:if>
									</c:forEach>
								</c:when>
							</c:choose>
							<c:if test="${pageInfo.pageNum == pageInfo.pages}">
								<li class="disabled">
									<span>
										下一页
									</span>
								</li>
								<li class="disabled">
									<span>
										尾页
									</span>
								</li>
							</c:if>
							<c:if test="${pageInfo.pageNum < pageInfo.pages}" >
								<li >
									<a href="${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageNum=${pageInfo.pageNum+1}&pageSize=${pageInfo.pageSize}">
										下一页
									</a>
								</li>
								<li >
									<a href="${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageNum=${pageInfo.pages}&pageSize=${pageInfo.pageSize}" aria-label="Next">
										尾页
									</a>
								</li>
							</c:if>
						</ul>
					</div>

				</div>
				<!-- /.box-footer-->

			</section>

		</div>
		<!-- 内容区域 /-->

		<!-- 底部导航 -->
		<%--<footer class="main-footer">--%>
		<%--<div class="pull-right hidden-xs">--%>
			<%--<b>Version</b> 1.0.8--%>
		<%--</div>--%>
		<%--<strong>Copyright &copy; 2014-2017 <a--%>
			<%--href="http://www..cn">研究院研发部</a>.--%>
		<%--</strong> All rights reserved. </footer>--%>
		<!-- 底部导航 /-->

	</div>


	<script
		src="${pageContext.request.contextPath}/plugins/jQuery/jquery-2.2.3.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/jQueryUI/jquery-ui.min.js"></script>
	<script>
		$.widget.bridge('uibutton', $.ui.button);
	</script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/raphael/raphael-min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/morris/morris.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/sparkline/jquery.sparkline.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/knob/jquery.knob.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/daterangepicker/moment.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/datepicker/bootstrap-datepicker.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/slimScroll/jquery.slimscroll.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/fastclick/fastclick.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/iCheck/icheck.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/adminLTE/js/app.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/select2/select2.full.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/js/markdown.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/js/to-markdown.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/ckeditor/ckeditor.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/input-mask/jquery.inputmask.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/input-mask/jquery.inputmask.extensions.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/datatables/jquery.dataTables.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/datatables/dataTables.bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/chartjs/Chart.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.resize.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.pie.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.categories.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/plugins/bootstrap-slider/bootstrap-slider.js"></script>
	<script>
		$(document).ready(function() {
			// 选择框
			$(".select2").select2();

			// WYSIHTML5编辑器
			$(".textarea").wysihtml5({
				locale : 'zh-CN'
			});
		});

		// 设置激活菜单
		function setSidebarActive(tagUri) {
			var liObj = $("#" + tagUri);
			if (liObj.length > 0) {
				liObj.parent().parent().addClass("active");
				liObj.addClass("active");
			}
		}

		$(document).ready(function() {
			$('#datepicker-a3').datepicker({
				autoclose : true,
				format : 'yyyy-mm-dd'
			});
		});

		$(document).ready(function() {
			// 激活导航位置
			setSidebarActive("order-manage");

            var cid = $("#cid").val();
            // 给提交页面导航设置跳转地址
            $("#tjym").attr('href','${pageContext.request.contextPath}/statistic/classMonthAvgDate?cid='+cid);

		});
	</script>

	<script>
		$(function () {

		    // 统一添加作业修改的日期
			$("#addform input[type='date']").change(function () {
			    var _this = this
                $.get("${pageContext.request.contextPath}/statistic/isZyDateRight?cid=${requestScope.cid}&recordDate="+this.value,function (res) {

                    if(res=='true'){
                          $("#addform .rq").val(_this.value)
					  }else{
                        $("#addform .rq").val("")
						alert("当前选择的时间数据库中已经存在！")
					}
                },"text")

            })

           // 统一添加作业修改的课程名称
            $("#addform .kc:first").blur(function () {
                $("#addform .kc:gt(0)").val(this.value)
            })


            // sel 分页事件
            $("#sel").on('change',function () {
                var pageSize = this.value;
                window.location.replace("${pageContext.request.contextPath}/statistic/zyAddPage?cid=${requestScope.cid}&recordDate=${date}&pageSize="+pageSize)
            })


        })


	</script>



</body>

</html>